package com.example.demomp.config;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * @Author: 张西华
 * @Date: 2023/04/13 10:54
 * @version: v1.0
 * @Description: TODO
 */
// 扫描我们的 mapper 文件夹
@MapperScan("com.example.demomp.mapper")
@EnableTransactionManagement //默认是打开的
@Configuration // 配置类
public class MyBatisPlusConfig {

    // 分页插件
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }

    // 注册乐观锁插件
    /*@Bean
    public OptimisticLockerInterceptor optimisticLockerInterceptor() {
        return new OptimisticLockerInterceptor();
    }*/
}

